<?php

namespace common\models;

use common\models\DividedPaymentsOrder;
use Yii;

/**
 * Class SpecialCard
 * @package common\model
 *
 * @property Custom $custom
 * @property SpecialCardAskLog[] $specialCardAskLogs
 * @property SpecialCardAskLog $lastSpecialCardAskLog
 */
class SpecialCard extends \common\models\base\SpecialCard
{
	const STATUS_DEFAULT = 10;
	const STATUS_HAS_SEND = 11;
	
	/**
	 * @return \yii\db\ActiveQuery
	 */
	public function getCustom()
	{
		return $this->hasOne(Custom::className(), ['id' => 'custom_id']);
	}
	
    /**
     * @return \yii\db\ActiveQuery
     */
    public function getSpecialCardAskLogs()
    {
        return $this->hasMany(SpecialCardAskLog::className(), ['special_card_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getLastSpecialCardAskLog()
    {
        return $this->hasOne(SpecialCardAskLog::className(), ['special_card_id' => 'id'])->orderBy(['time' => SORT_DESC]);
    }
}
